<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <title>医院病房管理系统 - 登录</title>
    <link rel="stylesheet" type="text/css" href="css/login.css">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
</head>
<body>
    <div class="login-container">
        <div class="login-box">
            <div class="login-header">
                <div class="logo">
                    <i class="fas fa-hospital"></i>
                </div>
                <h1>医院病房管理系统</h1>
            </div>
            <div class="role-select">
                <label>
                    <input type="radio" name="role" value="doctor" checked onclick="switchRole('doctor')">
                    <i></i>
                    <span><i class="fas fa-user-md"></i> 医生登录</span>
                </label>
                <label>
                    <input type="radio" name="role" value="admin" onclick="switchRole('admin')">
                    <i></i>
                    <span><i class="fas fa-user-shield"></i> 管理员登录</span>
                </label>
            </div>
            <form action="doctorLogin" method="post" class="login-form" id="doctorForm">
                <div class="form-group">
                    <div class="input-group">
                        <i class="fas fa-user"></i>
                        <input type="text" id="doctorId" name="doctorId" placeholder="请输入工号" required>
                    </div>
                </div>
                <div class="form-group">
                    <div class="input-group">
                        <i class="fas fa-lock"></i>
                        <input type="password" id="password" name="password" placeholder="请输入密码" required>
                    </div>
                </div>
                <div class="form-group">
                    <button type="submit" class="login-btn">登 录</button>
                </div>
                <% if(request.getAttribute("error") != null) { %>
                    <div class="error-message">
                        <i class="fas fa-exclamation-circle"></i>
                        <%= request.getAttribute("error") %>
                    </div>
                <% } %>
            </form>
            
            <form action="adminLogin" method="post" class="login-form" id="adminForm" style="display:none;">
                <div class="form-group">
                    <div class="input-group">
                        <i class="fas fa-user"></i>
                        <input type="text" name="username" placeholder="请输入用户名" required>
                    </div>
                </div>
                <div class="form-group">
                    <div class="input-group">
                        <i class="fas fa-lock"></i>
                        <input type="password" name="password" placeholder="请输入密码" required>
                    </div>
                </div>
                <div class="form-group">
                    <button type="submit" class="login-btn">登 录</button>
                </div>
            </form>
        </div>
    </div>
    
    <script>
    function switchRole(role) {
        if (role === 'admin') {
            document.getElementById('adminForm').style.display = 'block';
            document.getElementById('doctorForm').style.display = 'none';
        } else {
            document.getElementById('adminForm').style.display = 'none';
            document.getElementById('doctorForm').style.display = 'block';
        }
    }
    </script>
</body>
</html> 